import { Body, Controller, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { CreatePostDto } from './dto/create-post.dot';
import { PostsService } from './posts.service';

@Controller('posts')
@ApiTags('文章')
export class PostsController {
  constructor(private readonly postsService: PostsService) {}

  @Post('postTest')
  postTest() {
    return this.postsService.postTest();
  }

  /** 创建文章 */
  @ApiOperation({ summary: '创建文章' })
  @Post('create')
  async create(@Body() post: CreatePostDto) {
    return await this.postsService.create(post);
  }
}
